<div id="top_bar">
    <div class="topbar">
        <div class="bar">
            <div class="bar-left">
                <a href="admin-login.html"><i class="icon-tag" title="已通过点纳官方认证"></i></a>
                <a href="main-beta.html" class="bar-button">首页</a>
                {{#if bus_info.info.qq}}
                <a target="_blank" href="http://wpa.qq.com/msgrd?v=3&uin={{bus_info.info.qq}}&site=qq&menu=yes"><img class="chat" border="0" src="/images/chatqq.gif"  alt="点击这里给我发消息" title="点击这里给我发消息"/></a>
                {{/if}}
                <!-- src="http://wpa.qq.com/pa?p=2:{{bus_info.info.qq}}:51" -->
            </div>
            <div class="bar-right">
            {{#if loginer}}
            <a href="cart-beta.html" class="bar-button icon-cart">购物车</a>
            <a id="loginer_info" class="bar-button icon-user" href="./personal-beta.html">{{loginer.info.name}}</a>
            <a event-click="{{'$Event.user_login_out'}}" id="login_out" href="#">注销</a>
            {{#else}}
                {{#if $Cache._in_sign_in_or_up}}
                {{#else}}
                <a id="sign_in_btn" href="sign_in.html?id=1{{$Cache.cb_url}}" class="bar-button border icon-user">登陆</a>
                <a id="sign_up_btn" href="sign_in.html?id=2{{$Cache.cb_url}}" class="bar-button icon-pencil">注册</a>
                {{/if}}
            {{/if}}
            </div>
        </div>
    </div>
</div>
{{#if bus_info.config.using_bg_img}}
<img style="position: fixed;width: 100%;height: 100%;z-index: -1;top:0;left: 0;" src="{{bus_info.config.using_bg_img}}{{#if bus_info.config.is_bg_img_blur}}?imageMogr2/blur/10x10{{/if}}">
{{/if}}
<script type="text/vm">
    function (vm) {
        require(["common"], function(jSouper) {
            // var sign_in_btn_node = vm.queryElement({id:"sign_in_btn"})[0];
            // var sign_up_btn_node = vm.queryElement({id:"sign_up_btn"})[0];
            // var login_out_btn_node = vm.queryElement({id:"login_out"})[0];
            if (location.pathname !== "/sign_in.html") {
                var cb_url = "&cb_url=" + encodeURIComponent(location.href);
                // sign_in_btn_node.href += cb_url;
                // sign_up_btn_node.href += cb_url;
                App.set("$Cache.cb_url", cb_url);
            } else {
                App.set("$Cache._in_sign_in_or_up", true);
            }
            //注销功能
            jSouper.ready(function() {
                App.set("$Event.user_login_out", function() {
                    require(["Cookies"], function(Cookies) {
                        Cookies.set("loginSession", "");
                    });
                    App.set("loginer", null);
                });
            });
        });
// if (window.dispatchEvent) {
    
//         //自动跟随滚动功能
//     require(['jQuery'],function(){
//         $(function() {
//             var top_bar;
//             function _scroll_ () {
//                 if (!top_bar) {
//                     top_bar = $('#top_bar');
//                     if (top_bar.length) {
//                         _scroll_ = _scroll_2;
//                         _scroll_();
//                     }
//                 }
//             }
//             function _scroll_2 () {
//                 var _page_y = document.body.scrollTop || document.documentElement.scrollTop || window.pageYOffset;
//                 if(_page_y<=0){//最好不要盖住重要内容
//                     top_bar.css({'position':'relative','top':'0'});
//                 }else{
//                     top_bar.css({'position':'fixed','top':'0'});
//                 }
//             }
//             $(window).scroll(function(){
//                 _scroll_();
//             });
//         });
//     })
// }


    }
</script>